#include "storage.h"

void storage_read(u16 addr, u8 *buf, u16 len)
{
    EEPROM_read_n(addr, buf, len);
}

void storage_write(u16 addr, u8 *buf, u16 len)
{
    u8 __xdata sectorNum = len / 512 + 1;
    for(u8 __xdata i = 0; i < sectorNum; i++)
    {
        EEPROM_SectorErase(addr + 512 * i);
    }
    
    EEPROM_write_n(addr, buf, len);
}